package cn.rslee.uaas.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * 描述：
 * 
 * <pre>HISTORY
 * ****************************************************************************
 *  ID   DATE                   PERSON          REASON
 *  1    2016年2月19日      rslee               Create
 * ****************************************************************************
 * </pre>
 * @author rslee
 * @since 1.0
 * 
 * 用户访问日志实体类
 */
@Entity 
@Table(name = "UAAS_USER_ACCESS_LOG") 
public class AccessLog implements Serializable  {

	/**  */
	private static final long serialVersionUID = -3398651069272514161L;
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="ID")
	private Long id;
	
	@Column(name = "SYS_CODE")
	private String sysCode; //系统编码
	
	@Column(name = "UA")
	private String ua; //浏览器User-Agent
	
	@Column(name = "CLIENT_IP")
	private String clientIp; // 访问用户ip地址
	
	@Column(name = "SERVER_IP")
	private String serverIp;// 服务端ip地址
	
	@Column(name = "URL")
	private String url; //访问的url地址
	
	@Column(name = "URI")
	private String uri; //访问的url地址
	
	@Column(name = "REFERRER")
	private String referrer; //入口地址
	
	@Column(name = "USERNAME")
	private String username; //访问的用户名，没有的话就是guest
	
	@Column(name = "VISIT_TM")
	@Temporal(TemporalType.TIMESTAMP)
	private Date visitTm; //访问的时间戳
	
	

	public AccessLog() {
		super();
	}

	public AccessLog(String sysCode,String ua, String clientIp, String serverIp, String url,String uri,
			String referrer, String username, Date visitTm) {
		super();
		this.sysCode = sysCode;
		this.ua = ua;
		this.clientIp = clientIp;
		this.serverIp = serverIp;
		this.url = url;
		this.uri = uri;
		this.referrer = referrer;
		this.username = username;
		this.visitTm = visitTm;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getUa() {
		return ua;
	}

	public void setUa(String ua) {
		this.ua = ua;
	}

	public String getClientIp() {
		return clientIp;
	}

	public void setClientIp(String clientIp) {
		this.clientIp = clientIp;
	}

	public String getServerIp() {
		return serverIp;
	}

	public void setServerIp(String serverIp) {
		this.serverIp = serverIp;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	public String getUri() {
		return uri;
	}

	public void setUri(String uri) {
		this.uri = uri;
	}

	public String getReferrer() {
		return referrer;
	}

	public void setReferrer(String referrer) {
		this.referrer = referrer;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Date getVisitTm() {
		return visitTm;
	}

	public void setVisitTm(Date visitTm) {
		this.visitTm = visitTm;
	}

	@Override
	public String toString() {
		return "AccessLog [id=" + id + ", ua=" + ua + ", clientIp=" + clientIp
				+ ", serverIp=" + serverIp + ", url=" + url + ", uri=" + uri
				+ ", referrer=" + referrer + ", username=" + username
				+ ", visitTm=" + visitTm + "]";
	}

	public String getSysCode() {
		return sysCode;
	}

	public void setSysCode(String sysCode) {
		this.sysCode = sysCode;
	}
	
}
